ActionController::Routing::Routes.draw do |map|
  map.resources :mail_settings
  map.resources :news
  map.resources :blogs
  map.resources :forums
  map.resources :notices
  map.resources :questions
  map.resources :article_comments
  map.resources :admin_helpers

  map.resources :basetables

  map.resources :acrticle_comments

  map.resources :articles

  map.resources :categories

  map.resources :product_comments

  map.resources :product_contacts

  map.resources :contacts

  map.resources :product_images

  map.resources :product_images

  map.resources :sorts

  map.resources :sorts

  map.resources :prodcut_questions

  map.resources :production_images

  map.resources :products , :has_many => [:product_comments,:product_contacts] , :member => {:alipay => :post ,:buy => :get}

  map.resources :colors

  map.resources :sorts

  map.resources :colors
  
  map.resources :orders
  
  map.resources :forgotten_passwords
  map.resources :webs
  
  map.resource :ajax
  
  map.resources :ajax  ,:collection => {
    :province_select=>:post ,
    :city_select =>:post,
    :copy_user_info => :get,
    :color_sort => :get,
    :sort_sort => :get,
    :change_product_is_public => :get,
    :category_sort => :get,
    :change_category_is_public => :get,
    :set_recomm_product => :get ,
    :delete_product_image=>:get ,
    :product_image_sort =>:get
  }

  map.resource :cart, :only => [:show, :update] do |cart|
    cart.resources :items, :controller => 'cart_items', :only => [:create, :destroy]
  end
  map.forgot_password '/forgot_password', :controller => 'forgotten_passwords', :action => 'new'
  map.change_password '/change_password/:reset_code', :controller => 'forgotten_passwords', :action => 'reset'
  map.user '/users/:id', :controller => 'users', :action => 'show'
  map.logout '/logout', :controller => 'sessions', :action => 'destroy'
  map.login '/login', :controller => 'sessions', :action => 'new'
  map.register '/register', :controller => 'users', :action => 'create'
  map.signup '/signup', :controller => 'users', :action => 'new'
  map.activate '/activate', :controller => 'users', :action => 'activate'
  map.update '/update', :controller => 'users', :action => 'update'
  #  map.activate '/activate/:activation_code', :controller => 'users', :action => 'activate', :activation_code => nil
  map.admin_logout "admin/logout",:controller => "admin/sessions",:action => "logout"
  map.about "/about",:controller => "/home",:action => "about"
  map.resource :user ,  :only=> [:edit ,:update , :new]
  map.resources :sessions

  # The priority is based upon order of creation: first created -> highest priority.

  # Sample of regular route:
  #   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   map.resources :products

  # Sample resource route with options:
  #   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }

  # Sample resource route with sub-resources:
  #   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  
  # Sample resource route with more complex sub-resources
  #   map.resources :products do |products|
  #     products.resources :comments
  #     products.resources :sales, :collection => { :recent => :get }
  #   end

  # Sample resource route within a namespace:
  map.namespace :admin do |admin|
    # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
    admin.home '/' , :controller => :sessions ,:action => :new
    admin.resources :sessions , :collection => {:home => :get}
    admin.resources :products , :collection => {:select => :get}
    admin.resources :product_contacts
    admin.resources :product_comments
    admin.resources :admin_products
    admin.resources :users , :has_many => :roles , :collection => {:select => :get}
    admin.resources :roles , :has_many => :users
    admin.resources :permissions , :has_many => :roles
    admin.resources :colors
    admin.resources :sorts
    admin.resources :product_images
    admin.resources :articles , :collection => {:upload => :post}
    admin.resources :admin_articles , :collection => {:upload => :post}
    admin.resources :article_images
    admin.resources :admin_article_images
    admin.resources :article_comments
    admin.resources :article_comments
    admin.resources :admin_helpers
    admin.resources :basetables
    admin.resources :categories
    admin.resources :contacts
    admin.resources :mail_settings  , :collection => {:setmail => :get}
    admin.resources :orders
    admin.resources :order_lines
    admin.resources :webs
  end

  # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
  map.root :controller => "home" ,:aciton=>:index

  # See how all your routes lay out with "rake routes"

  # Install the default routes as the lowest priority.
  # Note: These default routes make all actions in every controller accessible via GET requests. You should
  # consider removing the them or commenting them out if you're using named routes and resources.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end
